<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>01书-1</title>
	</head>

	<body>

	</body>
	<script>
		//惰性载入单例
		var LazySingle = (function() {
			//单例实例引用
			var _instance = null;
			//单例
			function Single() {
				//这里定义私有属性和方法
				return {
					publicMethod: function() {},
					publicProperty: '1.0'
				}
			}
			//获取单例对象接口
			return function() {
				if(!_instance) {
					_instance = Single()
				}
				//返回单例
				return _instance;
			}
		})();

		var a = new LazySingle()
		var b = new LazySingle()
		console.log(a === b) //true
	</script>
</html>